package com.iis.databaseutil;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DatabaseConnection {

	static Connection myDataConnection;

	static final String DATABASE_URL = "jdbc:mysql://localhost:3306/iisdb";

	public static Connection getDataConnection() {
		if (myDataConnection == null) {
			try {
				Class.forName("com.mysql.jdbc.Driver").newInstance();
				myDataConnection = DriverManager.getConnection(DATABASE_URL,
						"root", "rootpassword");
			} catch (SQLException e) {
				e.printStackTrace();
			} catch (InstantiationException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		return myDataConnection;
	}

}
